<div>
<form class="form-horizontal" role="form" name="provAssessForm" novalidate>
  <div class="form-ctrl md-whiteframe-z1">
    <div class="form-search" style="height:160px;" ng-class="{true: 'shou'}[flag.formIsFold]" ng-switch="provAssessment.timeType.timeTypeCode">
      <div>
        <label style="">业务线</label>
        <md-select ng-model="provAssessment.businessLineCode" >
          <md-select-label>{{provAssessment.businessLineCode ? _getNames(provAssessment.businessLineCode,'businessLineName',selector.businessLineCode) : '银行总对总'}}</md-select-label>
          <md-option ng-value="business"  ng-repeat="business in selector.businessLineCode">{{business.businessLineName}}</md-option>
        </md-select>
      </div>
      <div>
        <label style="">账期</label>
        <md-select ng-model="provAssessment.timeType">
          <md-select-label>{{provAssessment.timeType ? _getNames(provAssessment.timeType,'timeTypeName',selector.timeType) : "日"}}</md-select-label>
          <md-option ng-value="timeType" ng-repeat="timeType in selector.timeType" >{{timeType.timeTypeName}}</md-option>
        </md-select>
      </div>
          <input-quarter-group start-time="provAssessment.quarter.startTime" end-time="provAssessment.quarter.endTime" ng-switch-when="4"></input-quarter-group>
          <div ng-if="!provAssessment.timeType || provAssessment.timeType.timeTypeCode !== '4'">
            <md-input-container flex>
              <label >开始时间</label>
              <input name="dateStartTime" type="date" end-time="date.endTime" time-validate="day" ng-model="date.startTime"  ng-switch-default required>
              <div ng-messages="provAssessForm.dateStartTime.$error">
                <div ng-message="date">请正确输入时间</div>
                <div ng-message="time-error">开始时间不应大于结束时间</div>
              </div>
              <input name="monthStartTime" ng-model="date.startTime"  end-time="date.endTime" time-validate="month"  type="month" ng-switch-when="3" required>
              <div ng-messages="provAssessForm.monthStartTime.$error">
                <div ng-message="date">请正确输入时间</div>
                <div ng-message="time-error">开始时间不应大于结束时间</div>
              </div>
              <input ng-model="date.startTime"  end-time="date.endTime" type="number" time-validate="year"  ng-switch-when="5" name="yearStartTime" required>
              <div ng-messages="provAssessForm.yearStartTime.$error">
                <div ng-message="required">请正确输入时间</div>
                <div ng-message="time-error">开始时间不应大于结束时间</div>
              </div>
            </md-input-container >
          </div>
          <div ng-if="!provAssessment.timeType || provAssessment.timeType.timeTypeCode !== '4'">
            <md-input-container flex>
              <label>结束时间</label>
              <input name="dateEndTime" type="date" ng-model="date.endTime"  start-time="date.startTime" time-validate="day" ng-switch-default required>
              <div ng-messages="provAssessForm.dateEndTime.$error">
                <div ng-message="date">请正确输入时间</div>
                <div ng-message="time-error">结束时间不应小于开始时间</div>
                <div ng-message="too-great">结束时间不应大于当前时间</div>
              </div>
              <input name="monthEndTime" ng-model="date.endTime"  type="month" start-time="date.startTime" time-validate="month" ng-switch-when="3" required>
              <div ng-messages="provAssessForm.monthEndTime.$error">
                <div ng-message="date">请正确输入时间</div>
                <div ng-message="time-error">结束时间不应小于开始时间</div>
                <div ng-message="too-great">结束时间不应大于当前时间</div>
              </div>
              <input ng-model="date.endTime"  start-time="date.startTime" type="number" time-validate="year" ng-switch-when="5" name="yearEndTime" required>
              <div ng-messages="provAssessForm.yearEndTime.$error">
                <div ng-message="required">请正确输入时间</div>
                <div ng-message="time-error">结束时间不应小于开始时间</div>
                <div ng-message="too-great">结束时间不应大于当前时间</div>
              </div>
            </md-input-container >
          </div>
    </div>
    <i class="glyphicon glyphicon-chevron-up shrinkage" ng-click="flag.formIsFold=true" ng-show="flag.showTable &&!(quarterInvalid||provAssessForm.$invalid)"></i>
    <md-button ng-click="provAssessQuery()" ng-disabled="quarterInvalid||provAssessForm.$invalid" class="md-fab md-primary md-hue-1" aria-label="Profile">
      <i class="glyphicon glyphicon-search"  ng-show="!flag.formIsFold"></i>
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="flag.formIsFold"></i>
    </md-button>
  </div>
</form>
<div class="table-info" ng-controller="provAssessViewCtrl">
  <div>
    <div class="menus" ng-show="flag.showTable">
      <form action="{{exportUrl}}"  target="_black"  method="post">
        <input type='hidden' name="data"  value='{{exportParam}}'>
        <md-button  type="submit"  class="md-raised">导出Excel</md-button>
      </form>
    </div>
    <div class="table-detail">
      <div class="t_r" style="padding: 30px 0px 0 0;overflow-x: scroll;" ng-show="flag.showTable">
        <!-- 天猫 移动商城可共用一个 注意改变thead里面的标题-->
        <table class="table table-bordered prov-table table-nowrap" ng-show="!flag.isBankCorporate" style="min-width: 100%;width: auto;table-layout: fixed;word-break:break-all;">
          <thead>
            <tr>
              <th colspan="2" style="width:50px;">{{viewObj.duration}}</th>
              <!-- colspan数值由错误码多少决定 数值为错误码lenth+5-->
              <th colspan="{{viewObj.rsp.length+5}}">{{viewObj.title}}业务质量指标</th>
            </tr>
            <tr>
              <th rowspan="2" style="width:70px;">省代码</th>
              <th rowspan="2" style="width:80px;">省公司</th>
              <th rowspan="2" style="width:80px;">交易总笔数</th>
              <th rowspan="2" style="width:80px;">成功总笔数</th>
              <th rowspan="2" style="width:80px;">失败总笔数</th>
              <!-- colspan数值由错误码多少决定-->
              <th colspan="{{viewObj.rsp.length}}">失败类型细分</th>
              <th rowspan="2" style="width:100px;">交易成功率</th>
              <th rowspan="2" style="width:70px;">得分</th>
            </tr>
            <tr>
              <!-- 错误码由此repeat td-->
              <th ng-repeat="rspCode in viewObj.rsp" style="width:50px">{{rspCode}}</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <tr ng-repeat="item in viewObj.series">
              <td>{{item.provinceCode}}</td>
              <td>{{item.provinceName}}</td>
              <td>{{item.data.tradeAmount}}</td>
              <td>{{item.data.successTradeAmount}}</td>
              <td>{{item.data.failTradeAmount}}</td>
              <!-- 错误码由此repeat td-->
              <td ng-repeat="subItem in item.data['rsp_value'] track by $index" title="{{subItem}}">{{subItem}}</td>
              <td title="{{item.data.successRate}}%">{{item.data.successRate}}%</td>
              <td>{{item.data.assessmentPoints}}</td>
            </tr>
          </tbody>
        </table>
        <!-- 总对总 -->
        <table class="table table-bordered prov-table table-nowrap" ng-show="flag.isBankCorporate" style="min-width: 100%;width: auto;table-layout: fixed;word-break:break-all;">
          <thead>
            <tr>
              <th colspan="2" style="width:150px;">{{viewObj.duration}}</th>
              <!-- colspan数值由错误码多少决定 数值为错误码lenth+5-->
              <th colspan="{{viewObj.rsp[tradeType.constract].length+viewObj.rsp[tradeType.payment].length+10}}">银行总对总业务质量指标</th>
            </tr>
            <tr>
              <th rowspan="3" style="width:70px;">省代码</th>
              <th rowspan="3" style="width:80px;">省公司</th>
              <th colspan="{{viewObj.rsp[tradeType.constract].length+5}}">缴费交易</th>
              <th colspan="{{viewObj.rsp[tradeType.payment].length+5}}">签约交易</th>
            </tr>
            <tr>
              <th rowspan="2" style="width:80px;">交易总笔数</th>
              <th rowspan="2" style="width:80px;">成功总笔数</th>
              <th rowspan="2" style="width:80px;">失败总笔数</th>
              <!-- colspan数值由错误码多少决定-->
              <th colspan="{{viewObj.rsp[tradeType.constract].length}}">失败类型细分</th>
              <th rowspan="2" style="width:100px;">交易成功率</th>
              <th rowspan="2" style="width:70px;">得分</th>

              <th rowspan="2" style="width:80px;">交易总笔数</th>
              <th rowspan="2" style="width:80px;">成功总笔数</th>
              <th rowspan="2" style="width:80px;">失败总笔数</th>
              <!-- colspan数值由错误码多少决定-->
              <th colspan="{{viewObj.rsp[tradeType.payment].length}}">失败类型细分</th>
              <th rowspan="2" style="width:100px;">交易成功率</th>
              <th rowspan="2" style="width:70px;">得分</th>
            </tr>
            <tr>
              <!-- 错误码由此repeat td-->
              <th ng-repeat="code03 in viewObj.rsp[tradeType.constract]" style="width:50px;">{{code03}}</th>

              <th ng-repeat="code04 in viewObj.rsp[tradeType.payment]" style="width:50px;">{{code04}}</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in viewObj.series">
              <td>{{item.provinceCode}}</td>
              <td>{{item.provinceName}}</td>
              <td>{{item[tradeType.constract].tradeAmount||0}}</td>
              <td>{{item[tradeType.constract].successTradeAmount||0}}</td>
              <td>{{item[tradeType.constract].failTradeAmount||0}}</td>
              <!-- 错误码由此repeat td-->
              <td ng-repeat="subItem in item[tradeType.constract]['rsp_value'] track by $index" title="{{subItem}}">{{subItem}}</td>
              <td title="{{item[tradeType.constract].successRate||0}}%">{{item[tradeType.constract].successRate||0}}%</td>
              <td>{{item[tradeType.constract].assessmentPoints||0}}</td>

              <td>{{item[tradeType.payment].tradeAmount||0}}</td>
              <td>{{item[tradeType.payment].successTradeAmount||0}}</td>
              <td>{{item[tradeType.payment].failTradeAmount||0}}</td>
              <!-- 错误码由此repeat td-->
              <td ng-repeat="subItem in item[tradeType.payment]['rsp_value'] track by $index">{{subItem}}</td>
              <td title="{{item[tradeType.payment].successRate||0}}%">{{item[tradeType.payment].successRate||0}}%</td>
              <td>{{item[tradeType.payment].assessmentPoints||0}}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
</div>